package com.chulianyuang.service.impl;

import com.chulianyuang.mapper.EmployeeMapper;
import com.chulianyuang.pojo.Employee;
import com.chulianyuang.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class EmployeeServiceImpl implements EmployeeService {
    @Autowired
    EmployeeMapper employeeMapper;
    @Override
    public Employee login(String sn, String pwd) {
            //调用持久层获得员工对象
            Employee empsel = employeeMapper.findEmpBySn(sn);
            if(empsel!=null){
                //判断密码
                if(empsel.getPassword().equals(pwd)){
                    return empsel;
                }
            }
            return null;
    }

    @Override
    public Employee findEmpByPname(String sn) {
        return  employeeMapper.findEmpByPId(sn).get(0);
    }

}
